// pages/order/detail/detail.js
var app =getApp();
Page({

  data: {
    url:{
      getData: app.url.baseUrl + "/my/appointmentDetail"
    },
    aid : '',
    aData : {},
    uname:null,
    utext:null,
    udate:null
  },
  onLoad: function (o) {
    this.setData({aid : o.aid})
    this.getDetail()
  },
  getDetail:function(){
    var data = {id:this.data.aid}
    var that = this;
    app.ajax(this.data.url.getData,data,function(res){
      var d = res.data.data
      var uname = null
      var utext =null
      var udate=null;
      if (d.stateName == '已取消'){
        uname = "我"
        utext = d.userEscReason
      } else if(d.reply != null && d.reply.length>0){
        uname = "店家"
        utext = d.reply
        udate = d.replyDate
      }
      that.setData({ aData : d,uname : uname,utext:utext,udate:udate})
    })
  }
})